**Clean wave 3 V3*
clear all

**Import raw data
import spss using "INDU0007_OUTPUT.sav", clear

***NOTE: variables are labeled with "3" to define them as taking place in wave 3 of the survey


**Rename and define education variable
rename educ educ3
label define educ_label 1 "No HS" 2 "High school graduate" 3 "Some college" 4 "2-year" 5 "4-year" 6 "Post-grad"
label values educ3 educ_label

*Designate weight for wave 3
rename weight weight3

**Define and label household size
rename q1 hhsize3
label define hhsizelabel 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8" 9 "9" 10 "10" 11 "11" 12 "12" 13 "13" 14 "14" 15 "15" 16 "16" 17 "17" 18 "18" 19 "19" 20 "20"
label values hhsize3 hhsizelabel

**Define and label number of children under 5 in the household
rename q2_a hh_under53
recode hh_under53 (1=0) (2=1) (3=2) (4=3) (5=4)
label define hhunder5label 0 "0" 1 "1" 2 "2" 3 "3" 4 "More than 3"
label values hh_under53 hhunder5label

**Define and label number of people over 65 in the household
gen hh_over653=.
replace hh_over653=0 if q2_b==1
replace hh_over653=1 if q2_b==2
replace hh_over653=2 if q2_b==3
replace hh_over653=3 if q2_b==4
replace hh_over653=4 if q2_b==5
label define hh_over65_label 0 "0" 1 "1" 2 "2" 3 "3" 4 "more than 3"
label val hh_over653 hh_over65_label
drop q2_b


**Define and label number of people with disability in the household
gen hh_disability3=.
replace hh_disability3=0 if q2_c==1
replace hh_disability3=1 if q2_c==2
replace hh_disability3=2 if q2_c==3
replace hh_disability3=3 if q2_c==4
replace hh_disability3=4 if q2_c==5
label define hh_disability_label 0 "0" 1 "1" 2 "2" 3 "3" 4 "more than 3"
label val hh_disability3 hh_disability_label
drop q2_c

**Did respondent move between wave 2 and wave 3, and if so what is their new dwelling type?
rename q4 moved
rename q6 dwelling_moved3


gen dwelling_type3=.
replace dwelling_type3=1 if dwelling_moved3 ==1
replace dwelling_type3=2 if dwelling_moved3 ==2
replace dwelling_type3=3 if dwelling_moved3 ==3
replace dwelling_type3=4 if dwelling_moved3 ==4
replace dwelling_type3=5 if dwelling_moved3 ==9
label var dwelling_type3 "Dwelling Type"
label define dwelling_typelabel 1 "Trailer or mobile home" 2 "Apartment/duplex/condominum" 3 "Detached, single family home" 4 "Attached single family home" 5 "Other"
label values dwelling_type3 dwelling_typelabel


rename q6_other dwelling_open3

**Rename income brackets for individuals based on their household size
rename q72_1 hh1_income3
rename q72_2 hh2_income3
rename q72_3 hh3_income3
rename q72_4 hh4_income3
rename q72_5 hh5_income3
rename q72_6 hh6_income3
rename q72_7 hh7_income3
rename q72_8 hh8_income3
rename q72_all income3


**Renaming responses to dwelling conditions (e.g., household deficiencies), then cleaning responses
***NOTE: these responses are only for respondents who moved***
rename q7_1 poor_insulation3
rename q7_2 drafty3
rename q7_3 mold3
rename q7_4 holes3
rename q7_5 plumbing3
rename q7_6 exposed_sockets3
rename q7_7 nonworking_stove_fridge3
rename q7_8 broken_heating3
rename q7_9 broken_ac3

replace poor_insulation3=0 if poor_insulation3 !=1
label define poorinsulation_label 0 "no" 1 "yes"
label values poor_insulation3 poorinsulation_label

replace drafty3=0 if drafty3 !=1
label define drafty_label 0 "no" 1 "yes"
label values drafty3 drafty_label

replace mold3=0 if mold3 !=1
label define mold_label 0 "no" 1 "yes"
label values mold3 mold_label

replace holes3=0 if holes3 !=1
label define holes_label 0 "no" 1 "yes"
label values holes3 holes_label

replace plumbing3=0 if plumbing3 !=1
label define plumbing_label 0 "no" 1 "yes"
label values plumbing3 plumbing_label

replace exposed_sockets3=0 if exposed_sockets3 !=1
label define exposed_sockets_label 0 "no" 1 "yes"
label values exposed_sockets3 exposed_sockets_label

replace nonworking_stove_fridge3=0 if nonworking_stove_fridge3 !=1
label define nonworking_stove_label 0 "no" 1 "yes"
label values nonworking_stove_fridge3 nonworking_stove_label

replace broken_heating3=0 if broken_heating3 !=1
label define broken_heating_label 0 "no" 1 "yes"
label values broken_heating3 broken_heating_label

replace broken_ac3=0 if broken_ac3 !=1
label define broken_ac_label 0 "no" 1 "yes"
label values broken_ac3 broken_ac_label


***Binary variable representing if a respondent indicated they had poor insulation, drafty air in their home, mold, holes, bad plumbing, exposed sockets, a stove or fridge that isn't currently working, or broken AC or heating
gen dwelling_condition3=.

replace dwelling_condition3=0 if poor_insulation3==0 & drafty3==0 & mold3==0 & holes3==0 & plumbing3==0 & exposed_sockets3==0 & nonworking_stove_fridge3==0 & broken_heating3==0 & broken_ac3==0

replace dwelling_condition3=1 if poor_insulation3==1 | drafty3==1 | mold3==1 | holes3==1 | plumbing3==1 | exposed_sockets3==1 |nonworking_stove_fridge3==1 | broken_heating3==1 | broken_ac3==1

label define dwelling_conditionlabel 0 "No dwelling conditions" 1 "At least 1 dwelling condition"
label values dwelling_condition3 dwelling_conditionlabel


**Fuel type that household uses for energy (electricity, gas, wood, propane, or fuel oil)
***NOTE: these responses are only for respondents who moved***
rename q8_1 electricity3
rename q8_2 gas3
rename q8_3 wood3
rename q8_4 propane3
rename q8_5 fueloil3

**respondents rating of trust in their electricity provider
rename q10 trust_energyco3
label define trust_label 0 "0 - Don't trust electricity company at all" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8" 9 "9" 10 "10 - Fully trust electricity company"
label values trust_energyco3 trust_label

** Who pays for household fuel? Options: household pays all, all included in rent, some are paid by the household, some included in rent
gen fuel_payment3=.
replace fuel_payment3=1 if q11_1==1 | q11_2==1 | q11_3==1 | q11_4==1 | q11_5==1
replace fuel_payment3=2 if q11_1==2 | q11_2==2 | q11_3==2 | q11_4==2 | q11_5==2
replace fuel_payment3=3 if q11_1==3 | q11_2==3 | q11_3==3 | q11_4==3 | q11_5==3
replace fuel_payment3=4 if q11_1==4 | q11_2==4 | q11_3==4 | q11_4==4 | q11_5==4
replace fuel_payment3=5 if q11_1==9 | q11_2==9 | q11_3==9 | q11_4==9 | q11_5==9
label var fuel_payment3 "Fuel Payment"
label define fuel_paymentlabel 1 "Household pays all" 2 "All included in Rent" 3 "Some household, some rent" 4 "Other" 5 "Don't know/not asked"
label values fuel_payment3 fuel_paymentlabel

**are respondents' recent energy bills less than, more than, are about the same amount as a typical month
rename q12 energybill_change3

**does respondent own their home?
rename ownhome ownhome3

gen homeowner3 = .
replace homeowner3 = 0 if ownhome3 ==2 | ownhome3 ==3
replace homeowner3 = 1 if ownhome3 ==1
label var homeowner3 "own home?"
label define homeownerlabel 0 "no" 1 "yes"
label values homeowner3 homeownerlabel

**Does a household member require the use of an at-home electronic device?
rename q13 electronic_device3
recode electronic_device3 (2=0)
label define device3_label 0 "no" 1 "yes"
label values electronic_device3 device3_label

**Has household installed energy efficient appliances to keep their energy prices lower?
rename q14_1 efficient_appliances3
recode efficient_appliances3 (2=0)
label define appliance_label 0 "no" 1 "yes"
label values efficient_appliances3 appliance_label
rename q14_2 efficient_insulation3
recode efficient_insulation3 (2=0)
label define insulation_label 0 "no" 1 "yes"
label values efficient_insulation3 insulation_label
rename q14_3 efficient_ac3
recode efficient_ac3 (2=0)
label define ac_label 0 "no" 1 "yes"
label values efficient_ac3 ac_label
rename q14_4 efficient_smartmeter3
recode efficient_smartmeter3 (2=0)
label define smartmeter_label 0 "no" 1 "yes"
label values efficient_smartmeter3 smartmeter_label
rename q14_5 efficient_lights3
recode efficient_lights3 (2=0)
label define lights_label 0 "no" 1 "yes"
label values efficient_lights3 lights_label
rename q14_6 efficient_hometemp3
recode efficient_hometemp3 (2=0)
label define hometemp_label 0 "no" 1 "yes"
label values efficient_hometemp3 hometemp_label
rename q14_7 efficient_devices3
recode efficient_devices3 (2=0)
label define devices_label 0 "no" 1 "yes"
label values efficient_devices3 devices_label
rename q14_8 efficient_hungwindow3
recode efficient_hungwindow3 (2=0)
label define hungwindow_label 0 "no" 1 "yes"
label values efficient_hungwindow3 hungwindow_label


***Could not pay household energy bill in the last 5 months and from which source
rename q15 hhbill_5months
recode hhbill_5months (2=0)
label define hhbill_5mo_label 0 "no" 1 "yes"
label values hhbill_5months hhbill_5mo_label

gen hhbill_september=0
replace hhbill_september=1 if q16_1==1

gen hhbill_october=0
replace hhbill_october=1 if q16_2==1

gen hhbill_november=0
replace hhbill_november=1 if q16_3==1

gen hhbill_december=0
replace hhbill_december=1 if q16_4==1

gen hhbill_january=0
replace hhbill_january=1 if q16_5==1

drop q16_1 q16_2 q16_3 q16_4 q16_5

gen hhbill_source_electric=0
replace hhbill_source_electric=1 if q17_1==1

gen hhbill_source_natgas=0
replace hhbill_source_natgas=1 if q17_2==1

gen hhbill_source_fuel=0
replace hhbill_source_fuel=1 if q17_3==1

drop q17_1 q17_2 q17_3


**did household receive a disconnection notice in last 5 months and from which source
rename q18 notice_5months
recode notice_5months (2=0)
label define notice_5mo_label 0 "no" 1 "yes"
label values notice_5months notice_5mo_label


gen notice_september=0
replace notice_september=1 if q19_1==1

gen notice_october=0
replace notice_october=1 if q19_2==1

gen notice_november=0
replace notice_november=1 if q19_3==1

gen notice_december=0
replace notice_december=1 if q19_4==1

gen notice_january=0
replace notice_january=1 if q19_5==1

drop q19_1 q19_2 q19_3 q19_4 q19_5


gen notice_source_electric=0
replace notice_source_electric=1 if q20_1==1

gen notice_source_natgas=0
replace notice_source_natgas=1 if q20_2==1

gen notice_source_fuel=0
replace notice_source_fuel=1 if q20_3==1

drop q20_1 q20_2 q20_3



**did household get disconnected in last 5 months and from which source
gen disconnect_5months=0
replace disconnect_5months=1 if q21==1
recode disconnect_5months (2=0)
label define disconnect_5mo_label 0 "no" 1 "yes"
label values disconnect_5months disconnect_5mo_label

drop q21

gen disconnect_september=0
replace disconnect_september=1 if q22_1==1

gen disconnect_october=0
replace disconnect_october=1 if q22_2==1

gen disconnect_november=0
replace disconnect_november=1 if q22_3==1

gen disconnect_december=0
replace disconnect_december=1 if q22_2==1

gen disconnect_january=0
replace disconnect_january=1 if q22_3==1

drop q22_1 q22_2 q22_3 q22_4 q22_5


gen disconnect_source_electric=0
replace disconnect_source_electric=1 if q23_1==1

gen disconnect_source_natgas=0
replace disconnect_source_natgas=1 if q23_2==1

gen disconnect_source_fuel=0
replace disconnect_source_fuel=1 if q23_3==1

drop q23_1 q23_2 q23_3



**if a respondent recieved a disconnection notice, in which form did that notice arrive (a call, a letter, a door knock, an email, or a text?)
rename q24_1 form_call3
recode form_call3 (2=0)
label define form_call3_label 0 "no" 1 "yes"
label values form_call3 form_call3_label
rename q24_2 form_letter3
recode form_letter3 (2=0)
label define form_letter3_label 0 "no" 1 "yes"
label values form_letter3 form_letter3_label
rename q24_3 form_doorknock3
recode form_doorknock3 (2=0)
label define form_doorknock3_label 0 "no" 1 "yes"
label values form_doorknock3 form_doorknock3_label
rename q24_4 form_email3
recode form_email3 (2=0)
label define form_email3_label 0 "no" 1 "yes"
label values form_email3 form_email3_label
rename q24_5 form_text3
recode form_text3 (2=0)
label define form_text3_label 0 "no" 1 "yes"
label values form_text3 form_text3_label


**if a respondent recieved a disconnection notice, how did they respond (contacted utility, set up a payment plan, sought legal service, sought government assistance, searched online for solutions, made changes to reduce energy consumption, or moved?)
rename q25_1 response_contactutility3
recode response_contactutility3 (2=0)
label define response_contact_label 0 "no" 1 "yes"
label values response_contactutility3 response_contact_label
rename q25_2 response_paymentplan3
recode response_paymentplan3 (2=0)
label define response_paymentplan_label 0 "no" 1 "yes"
label values response_paymentplan3 response_paymentplan_label
rename q25_3 response_legalservices3
recode response_legalservices3 (2=0)
label define response_legalservices_label 0 "no" 1 "yes"
label values response_legalservices3 response_legalservices_label
rename q25_4 response_assistance3
recode response_assistance3 (2=0)
label define response_assistance_label 0 "no" 1 "yes"
label values response_assistance3 response_assistance_label
rename q25_5 response_internet3
recode response_internet3 (2=0)
label define response_internet_label 0 "no" 1 "yes"
label values response_internet3 response_internet_label
rename q25_6 response_homechanges3
recode response_homechanges3 (2=0)
label define response_homechanges_label 0 "no" 1 "yes"
label values response_homechanges3 response_homechanges_label
rename q25_7 response_reduceenergy3
recode response_reduceenergy3 (2=0)
label define response_reduceenergy_label 0 "no" 1 "yes"
label values response_reduceenergy3 response_reduceenergy_label
rename q25_8 response_moved3
recode response_moved3 (2=0)
label define response_moved_label 0 "no" 1 "yes"
label values response_moved3 response_moved_label


**if a respondent received a disconnection notice, did they seek help from the following sources (a government agency, a bank, a payday loan service, their utility, a non profit, a faith based organization, or friends/family members?)
rename q26_1 sought_govagency3
recode sought_govagency3 (2=0)
label define sought_agency3_label 0 "no" 1 "yes"
label values sought_govagency3 sought_agency3_label
rename q26_2 sought_bank3
recode sought_bank3 (2=0)
label define sought_bank3_label 0 "no" 1 "yes"
label values sought_bank3 sought_bank3_label
rename q26_3 sought_payday3
recode sought_payday3 (2=0)
label define sought_payday3_label 0 "no" 1 "yes"
label values sought_payday3 sought_payday3_label
rename q26_4 sought_utility3
recode sought_utility3 (2=0)
label define sought_utility3_label 0 "no" 1 "yes"
label values sought_utility3 sought_utility3_label
rename q26_5 sought_nonprofit3
recode sought_nonprofit3 (2=0)
label define sought_nonprofit3_label 0 "no" 1 "yes"
label values sought_nonprofit3 sought_nonprofit3_label
rename q26_6 sought_faithbased3
recode sought_faithbased3 (2=0)
label define sought_faithbased3_label 0 "no" 1 "yes"
label values sought_faithbased3 sought_faithbased3_label
rename q26_7 sought_family_friends3
recode sought_family_friends3 (2=0)
label define sought_family_friends3_label 0 "no" 1 "yes"
label values sought_family_friends3 sought_family_friends3_label

**did the respondent receive the help they sought
rename q27 received_assistance3
recode received_assistance3 (2=0)
label define received_assistance3_label 0 "no" 1 "yes"
label values received_assistance3 received_assistance3_label

**when a respondent was disconnected, how did they respond (moved temporarily/permanently, lived without electricity, got helped from someone other than the utility company, paid off their bill, used an alternative energy source, used their car or a batter for energy?)
rename q28_1 response_moved_temp3
recode response_moved_temp3 (2=0)
label define response_moved_temp_label 0 "no" 1 "yes"
label values response_moved_temp3 response_moved_temp_label
rename q28_2 response_moved_perm3
recode response_moved_perm3 (2=0)
label define response_moved_perm_label 0 "no" 1 "yes"
label values response_moved_perm3 response_moved_perm_label
rename q28_3 response_livedwithout3
recode response_livedwithout3 (2=0)
label define response_livedwithout_label 0 "no" 1 "yes"
label values response_livedwithout3 response_livedwithout_label
rename q28_4 response_otherhelp3
recode response_otherhelp3 (2=0)
label define response_otherhelp_label 0 "no" 1 "yes"
label values response_otherhelp3 response_otherhelp_label
rename q28_5 response_paidoff3
recode response_paidoff3 (2=0)
label define response_paidoff_label 0 "no" 1 "yes"
label values response_paidoff3 response_paidoff_label
rename q28_6 response_usedothers3
recode response_usedothers3 (2=0)
label define response_usedothers_label 0 "no" 1 "yes"
label values response_usedothers3 response_usedothers_label
rename q28_7 response_carorbattery3
recode response_carorbattery3 (2=0)
label define response_carorbattery_label 0 "no" 1 "yes"
label values response_carorbattery3 response_carorbattery_label


**For respondents who were disconnected, how much was the reconnection fee to get service turned back on
rename q29 reconnection_cost3

**did a respondent receieve assistance in paying their energy bill in the last 5 months from the following sources: government agency, their energy provider, a friend or family member, a faith-based organization, a nonprofit, a payday lender, or a bank loan
rename q30_1 gov_agency_5mos
rename q30_2 energy_provider_5mos
rename q30_3 friend_family_5mos
rename q30_4 faith_org_5mos
rename q30_5 nonprofit_5mos
rename q30_6 payday_lender_5mos
rename q30_7 bankloan_5mos


replace gov_agency_5mos=0 if gov_agency_5mos !=1
label define gov_agency_5label 0 "no" 1 "yes"
label values gov_agency_5mos gov_agency_5label

replace energy_provider_5mos=0 if energy_provider_5mos !=1
label define energy_provider_5label 0 "no" 1 "yes"
label values energy_provider_5mos energy_provider_5label

replace friend_family_5mos=0 if friend_family_5mos !=1
label define friend_family_5label 0 "no" 1 "yes"
label values friend_family_5mos friend_family_5label

replace faith_org_5mos=0 if faith_org_5mos !=1
label define faith_org_5label 0 "no" 1 "yes"
label values faith_org_5mos faith_org_5label

replace nonprofit_5mos=0 if nonprofit_5mos !=1
label define nonprofit_5label 0 "no" 1 "yes"
label values nonprofit_5mos nonprofit_5label

replace payday_lender_5mos=0 if payday_lender_5mos !=1
label define payday_lender_5label 0 "no" 1 "yes"
label values payday_lender_5mos payday_lender_5label

replace bankloan_5mos=0 if bankloan_5mos !=1
label define bankloan_5label 0 "no" 1 "yes"
label values bankloan_5mos bankloan_5label



**Binary variable indicating if a respondent received assistance paying their energy bill in the last 5 months
gen energy_assistance_5mos=.

replace energy_assistance_5mos=0 if gov_agency_5mos==0 & energy_provider_5mos==0 & friend_family_5mos==0 & faith_org_5mos==0 & nonprofit_5mos==0 & payday_lender_5mos==0 & bankloan_5mos==0

replace energy_assistance_5mos=1 if gov_agency_5mos==1 | energy_provider_5mos==1 | friend_family_5mos==1 | faith_org_5mos==1 | nonprofit_5mos==1 | payday_lender_5mos==1 | bankloan_5mos==1

label define energy_assist5label 0 "No assistance" 1 "Assistance from at least one source"
label values energy_assistance_5mos energy_assist5label



**did a respondent receieve assistance in paying their energy bill in September from the following sources: government agency, their energy provider, a friend or family member, a faith-based organization, a nonprofit, a payday lender, or a bank loan
rename q31a_1 gov_agency_september
rename q31b_1 energy_provider_september
rename q31c_1 friend_family_september
rename q31d_1 faith_org_september
rename q31e_1 nonprofit_september
rename q31f_1 payday_lender_september
rename q31g_1 bankloan_september


replace gov_agency_september=0 if gov_agency_september !=1
label define gov_agency_septemberlabel 0 "no" 1 "yes"
label values gov_agency_september gov_agency_septemberlabel

replace energy_provider_september=0 if energy_provider_september !=1
label define energy_provider_septemberlabel 0 "no" 1 "yes"
label values energy_provider_september energy_provider_septemberlabel

replace friend_family_september=0 if friend_family_september !=1
label define friend_family_septemberlabel 0 "no" 1 "yes"
label values friend_family_september friend_family_septemberlabel

replace faith_org_september=0 if faith_org_september !=1
label define faith_org_septemberlabel 0 "no" 1 "yes"
label values faith_org_september faith_org_septemberlabel

replace nonprofit_september=0 if nonprofit_september !=1
label define nonprofit_septemberlabel 0 "no" 1 "yes"
label values nonprofit_september nonprofit_septemberlabel

replace payday_lender_september=0 if payday_lender_september !=1
label define payday_lender_septemberlabel 0 "no" 1 "yes"
label values payday_lender_september payday_lender_septemberlabel

replace bankloan_september=0 if bankloan_september !=1
label define bankloan_septemberlabel 0 "no" 1 "yes"
label values bankloan_september bankloan_septemberlabel


**Binary variable indicating if a respondent received assistance paying their energy bill in September
gen energy_assistance_september=.

replace energy_assistance_september=0 if gov_agency_september==0 & energy_provider_september==0 & friend_family_september==0 & faith_org_september==0 & nonprofit_september==0 & payday_lender_september==0 & bankloan_september==0

replace energy_assistance_september=1 if gov_agency_september==1 | energy_provider_september==1 | friend_family_september==1 | faith_org_september==1 | nonprofit_september==1 | payday_lender_september==1 | bankloan_september==1

label define energy_assistSlabel 0 "No assistance" 1 "Assistance from at least one source"
label values energy_assistance_september energy_assistSlabel


**did a respondent receieve assistance in paying their energy bill in October from the following sources: government agency, their energy provider, a friend or family member, a faith-based organization, a nonprofit, a payday lender, or a bank loan
rename q31a_2 gov_agency_october
rename q31b_2 energy_provider_october
rename q31c_2 friend_family_october
rename q31d_2 faith_org_october
rename q31e_2 nonprofit_october
rename q31f_2 payday_lender_october
rename q31g_2 bankloan_october


replace gov_agency_october=0 if gov_agency_october !=1
label define gov_agency_octoberlabel 0 "no" 1 "yes"
label values gov_agency_october gov_agency_octoberlabel

replace energy_provider_october=0 if energy_provider_october !=1
label define energy_provider_octoberlabel 0 "no" 1 "yes"
label values energy_provider_october energy_provider_octoberlabel

replace friend_family_october=0 if friend_family_october !=1
label define friend_family_octoberlabel 0 "no" 1 "yes"
label values friend_family_october friend_family_octoberlabel

replace faith_org_october=0 if faith_org_october !=1
label define faith_org_octoberlabel 0 "no" 1 "yes"
label values faith_org_october faith_org_octoberlabel

replace nonprofit_october=0 if nonprofit_october !=1
label define nonprofit_octoberlabel 0 "no" 1 "yes"
label values nonprofit_october nonprofit_octoberlabel

replace payday_lender_october=0 if payday_lender_october !=1
label define payday_lender_octoberlabel 0 "no" 1 "yes"
label values payday_lender_october payday_lender_octoberlabel

replace bankloan_october=0 if bankloan_october !=1
label define bankloan_octoberlabel 0 "no" 1 "yes"
label values bankloan_october bankloan_octoberlabel


**Binary variable indicating if a respondent received assistance paying their energy bill in october
gen energy_assistance_october=.

replace energy_assistance_october=0 if gov_agency_october==0 & energy_provider_october==0 & friend_family_october==0 & faith_org_october==0 & nonprofit_october==0 & payday_lender_october==0 & bankloan_october==0

replace energy_assistance_october=1 if gov_agency_october==1 | energy_provider_october==1 | friend_family_october==1 | faith_org_october==1 | nonprofit_october==1 | payday_lender_october==1 | bankloan_october==1

label define energy_assistOlabel 0 "No assistance" 1 "Assistance from at least one source"
label values energy_assistance_october energy_assistOlabel



**did a respondent receieve assistance in paying their energy bill in November from the following sources: government agency, their energy provider, a friend or family member, a faith-based organization, a nonprofit, a payday lender, or a bank loan
rename q31a_3 gov_agency_november
rename q31b_3 energy_provider_november
rename q31c_3 friend_family_november
rename q31d_3 faith_org_november
rename q31e_3 nonprofit_november
rename q31f_3 payday_lender_november
rename q31g_3 bankloan_november

replace gov_agency_november=0 if gov_agency_november !=1
label define gov_agency_novemberlabel 0 "no" 1 "yes"
label values gov_agency_november gov_agency_novemberlabel

replace energy_provider_november=0 if energy_provider_november !=1
label define energy_provider_novemberlabel 0 "no" 1 "yes"
label values energy_provider_november energy_provider_novemberlabel

replace friend_family_november=0 if friend_family_november !=1
label define friend_family_novemberlabel 0 "no" 1 "yes"
label values friend_family_november friend_family_novemberlabel

replace faith_org_november=0 if faith_org_november !=1
label define faith_org_novemberlabel 0 "no" 1 "yes"
label values faith_org_november faith_org_novemberlabel

replace nonprofit_november=0 if nonprofit_november !=1
label define nonprofit_novemberlabel 0 "no" 1 "yes"
label values nonprofit_november nonprofit_novemberlabel

replace payday_lender_november=0 if payday_lender_november !=1
label define payday_lender_novemberlabel 0 "no" 1 "yes"
label values payday_lender_november payday_lender_novemberlabel

replace bankloan_november=0 if bankloan_november !=1
label define bankloan_novemberlabel 0 "no" 1 "yes"
label values bankloan_november bankloan_novemberlabel


**Binary variable indicating if a respondent received assistance paying their energy bill in november
gen energy_assistance_november=.

replace energy_assistance_november=0 if gov_agency_november==0 & energy_provider_november==0 & friend_family_november==0 & faith_org_november==0 & nonprofit_november==0 & payday_lender_november==0 & bankloan_november==0

replace energy_assistance_november=1 if gov_agency_november==1 | energy_provider_november==1 | friend_family_november==1 | faith_org_november==1 | nonprofit_november==1 | payday_lender_november==1 | bankloan_november==1

label define energy_assistNlabel 0 "No assistance" 1 "Assistance from at least one source"
label values energy_assistance_november energy_assistNlabel



**did a respondent receieve assistance in paying their energy bill in December from the following sources: government agency, their energy provider, a friend or family member, a faith-based organization, a nonprofit, a payday lender, or a bank loan
rename q31a_4 gov_agency_december
rename q31b_4 energy_provider_december
rename q31c_4 friend_family_december
rename q31d_4 faith_org_december
rename q31e_4 nonprofit_december
rename q31f_4 payday_lender_december
rename q31g_4 bankloan_december


replace gov_agency_december=0 if gov_agency_december !=1
label define gov_agency_decemberlabel 0 "no" 1 "yes"
label values gov_agency_december gov_agency_decemberlabel

replace energy_provider_december=0 if energy_provider_december !=1
label define energy_provider_decemberlabel 0 "no" 1 "yes"
label values energy_provider_december energy_provider_decemberlabel

replace friend_family_december=0 if friend_family_december !=1
label define friend_family_decemberlabel 0 "no" 1 "yes"
label values friend_family_december friend_family_decemberlabel

replace faith_org_december=0 if faith_org_december !=1
label define faith_org_decemberlabel 0 "no" 1 "yes"
label values faith_org_december faith_org_decemberlabel

replace nonprofit_december=0 if nonprofit_december !=1
label define nonprofit_decemberlabel 0 "no" 1 "yes"
label values nonprofit_december nonprofit_decemberlabel

replace payday_lender_december=0 if payday_lender_december !=1
label define payday_lender_decemberlabel 0 "no" 1 "yes"
label values payday_lender_december payday_lender_decemberlabel

replace bankloan_december=0 if bankloan_december !=1
label define bankloan_decemberlabel 0 "no" 1 "yes"
label values bankloan_december bankloan_decemberlabel


**Binary variable indicating if a respondent received assistance paying their energy bill in december
gen energy_assistance_december=.

replace energy_assistance_december=0 if gov_agency_december==0 & energy_provider_december==0 & friend_family_december==0 & faith_org_december==0 & nonprofit_december==0 & payday_lender_december==0 & bankloan_december==0

replace energy_assistance_december=1 if gov_agency_december==1 | energy_provider_december==1 | friend_family_december==1 | faith_org_december==1 | nonprofit_december==1 | payday_lender_december==1 | bankloan_december==1

label define energy_assistDlabel 0 "No assistance" 1 "Assistance from at least one source"
label values energy_assistance_december energy_assistDlabel



**did a respondent receieve assistance in paying their energy bill in January from the following sources: government agency, their energy provider, a friend or family member, a faith-based organization, a nonprofit, a payday lender, or a bank loan
rename q31a_5 gov_agency_january
rename q31b_5 energy_provider_january
rename q31c_5 friend_family_january
rename q31d_5 faith_org_january
rename q31e_5 nonprofit_january
rename q31f_5 payday_lender_january
rename q31g_5 bankloan_january

replace gov_agency_january=0 if gov_agency_january !=1
label define gov_agency_januarylabel 0 "no" 1 "yes"
label values gov_agency_january gov_agency_januarylabel

replace energy_provider_january=0 if energy_provider_january !=1
label define energy_provider_januarylabel 0 "no" 1 "yes"
label values energy_provider_january energy_provider_januarylabel

replace friend_family_january=0 if friend_family_january !=1
label define friend_family_januarylabel 0 "no" 1 "yes"
label values friend_family_january friend_family_januarylabel

replace faith_org_january=0 if faith_org_january !=1
label define faith_org_januarylabel 0 "no" 1 "yes"
label values faith_org_january faith_org_januarylabel

replace nonprofit_january=0 if nonprofit_january !=1
label define nonprofit_januarylabel 0 "no" 1 "yes"
label values nonprofit_january nonprofit_januarylabel

replace payday_lender_january=0 if payday_lender_january !=1
label define payday_lender_januarylabel 0 "no" 1 "yes"
label values payday_lender_january payday_lender_januarylabel

replace bankloan_january=0 if bankloan_january !=1
label define bankloan_januarylabel 0 "no" 1 "yes"
label values bankloan_january bankloan_januarylabel


**Binary variable indicating if a respondent received assistance paying their energy bill in january
gen energy_assistance_january=.

replace energy_assistance_january=0 if gov_agency_january==0 & energy_provider_january==0 & friend_family_january==0 & faith_org_january==0 & nonprofit_january==0 & payday_lender_january==0 & bankloan_january==0

replace energy_assistance_january=1 if gov_agency_january==1 | energy_provider_january==1 | friend_family_january==1 | faith_org_january==1 | nonprofit_january==1 | payday_lender_january==1 | bankloan_january==1

label define energy_assistJlabel 0 "No assistance" 1 "Assistance from at least one source"
label values energy_assistance_january energy_assistJlabel







**did respondent have to forgo basic household expenses to pay an energy bill in the last 5 months
gen forego_expenses_5mos=0
replace forego_expenses_5mo=1 if q32==1

gen forego_expenses_september=0
replace forego_expenses_september=1 if q33_1==1

gen forego_expenses_october=0
replace forego_expenses_october=1 if q33_2==1

gen forego_expenses_november=0
replace forego_expenses_november=1 if q33_3==1

gen forego_expenses_december=0
replace forego_expenses_december=1 if q33_4==1

gen forego_expenses_january=0
replace forego_expenses_january=1 if q33_5==1



drop q32 q33_1 q33_2 q33_3 q33_4 q33_5


**did respondent receive WAP (Weatherization Assistance Program), LIHEAP (Low-Income Housing Energy Assistance Progam), SNAP, TANF, SSI, Medicaid, Veterans Benefits, Unemployment Insurance, and a COVID stimulus check in the last 5 months
rename q34_1 wap_5mos
rename q34_2 liheap_5mos
rename q34_3 snap_5mos
rename q34_4 tanf_5mos
rename q34_5 ssi_5mos
rename q34_6 medicaid_5mos
rename q34_7 medicare_5mos
rename q34_8 vet_benefits_5mos
rename q34_9 unemp_insurance_5mos

gen stimulus_5mos=0
replace stimulus_5mos=1 if q73==1
label define stimulus_label 0 "no" 1 "yes"
label var stimulus_5mos stimulus_label



replace wap_5mos=0 if wap_5mos !=1
label define wap_5label 0 "no" 1 "yes"
label values wap_5mos wap_5label

replace liheap_5mos=0 if liheap_5mos !=1
label define liheap_5label 0 "no" 1 "yes"
label values liheap_5mos liheap_5label

replace snap_5mos=0 if snap_5mos !=1
label define snap_5label 0 "no" 1 "yes"
label values snap_5mos snap_5label

replace tanf_5mos=0 if tanf_5mos !=1
label define tanf_5label 0 "no" 1 "yes"
label values tanf_5mos tanf_5label

replace ssi_5mos=0 if ssi_5mos !=1
label define ssi_5label 0 "no" 1 "yes"
label values ssi_5mos ssi_5label

replace medicaid_5mos=0 if medicaid_5mos !=1
label define medicaid_5label 0 "no" 1 "yes"
label values medicaid_5mos medicaid_5label

replace vet_benefits_5mos=0 if vet_benefits_5mos !=1
label define vet_benefits_5label 0 "no" 1 "yes"
label values vet_benefits_5mos vet_benefits_5label

replace unemp_insurance_5mos=0 if unemp_insurance_5mos !=1
label define unemp_insurance_5label 0 "no" 1 "yes"
label values unemp_insurance_5mos unemp_insurance_5label


**Binary variable representing whether respondent received government assistance in the previous 5 months
gen gov_assistance_5months=.

replace gov_assistance_5months=0 if wap_5mos==0 & liheap_5mos==0 & snap_5mos==0 & tanf_5mos==0 & ssi_5mos==0 & medicaid_5mos==0 & vet_benefits_5mos==0 & unemp_insurance_5mos==0

replace gov_assistance_5months=1 if wap_5mos==1 | liheap_5mos==1 | snap_5mos==1 | tanf_5mos==1 | ssi_5mos==1 | medicaid_5mos==1 | vet_benefits_5mos==1 | unemp_insurance_5mos==1

label define gov_assist5monthslabel 0 "No assistance" 1 "Assistance from at least one source"
label values gov_assistance_5months gov_assist5monthslabel



**did respondent receive WAP (Weatherization Assistance Program), LIHEAP (Low-Income Housing Energy Assistance Progam), SNAP, TANF, SSI, Medicaid, Veterans Benefits, Unemployment Insurance, and a COVID stimulus check in September
rename q38a_1 wap_september
rename q38b_1 liheap_september
rename q38c_1 snap_september
rename q38d_1 tanf_september
rename q38e_1 ssi_september
rename q38f_1 medicaid_september
rename q38g_1 medicare_september
rename q38h_1 vet_benefits_september
rename q38i_1 unemp_insurance_september
rename q38j_1 stimulus_september


replace wap_september=0 if wap_september !=1
label define wap_septemberlabel 0 "no" 1 "yes"
label values wap_september wap_septemberlabel

replace liheap_september=0 if liheap_september !=1
label define liheap_septemberlabel 0 "no" 1 "yes"
label values liheap_september liheap_septemberlabel

replace snap_september=0 if snap_september !=1
label define snap_septemberlabel 0 "no" 1 "yes"
label values snap_september snap_septemberlabel

replace tanf_september=0 if tanf_september !=1
label define tanf_septemberlabel 0 "no" 1 "yes"
label values tanf_september tanf_septemberlabel

replace ssi_september=0 if ssi_september !=1
label define ssi_septemberlabel 0 "no" 1 "yes"
label values ssi_september ssi_septemberlabel

replace medicaid_september=0 if medicaid_september !=1
label define medicaid_septemberlabel 0 "no" 1 "yes"
label values medicaid_september medicaid_septemberlabel

replace vet_benefits_september=0 if vet_benefits_september !=1
label define vet_benefits_septemberlabel 0 "no" 1 "yes"
label values vet_benefits_september vet_benefits_septemberlabel

replace unemp_insurance_september=0 if unemp_insurance_september !=1
label define unemp_insurance_septemberlabel 0 "no" 1 "yes"
label values unemp_insurance_september unemp_insurance_septemberlabel


**Binary variable representing whether respondent received government assistance in September
gen gov_assistance_september=.

replace gov_assistance_september=0 if wap_september==0 & liheap_september==0 & snap_september==0 & tanf_september==0 & ssi_september==0 & medicaid_september==0 & vet_benefits_september==0 & unemp_insurance_september==0

replace gov_assistance_september=1 if wap_september==1 | liheap_september==1 | snap_september==1 | tanf_september==1 | ssi_september==1 | medicaid_september==1 | vet_benefits_september==1 | unemp_insurance_september==1

label define gov_assistseptemberlabel 0 "No assistance" 1 "Assistance from at least one source"
label values gov_assistance_september gov_assistseptemberlabel



**did respondent receive WAP (Weatherization Assistance Program), LIHEAP (Low-Income Housing Energy Assistance Progam), SNAP, TANF, SSI, Medicaid, Veterans Benefits, Unemployment Insurance, and a COVID stimulus check in October
rename q38a_2 wap_october
rename q38b_2 liheap_october
rename q38c_2 snap_october
rename q38d_2 tanf_october
rename q38e_2 ssi_october
rename q38f_2 medicaid_october
rename q38g_2 medicare_october
rename q38h_2 vet_benefits_october
rename q38i_2 unemp_insurance_october
rename q38j_2 stimulus_october


replace wap_october=0 if wap_october !=1
label define wap_octoberlabel 0 "no" 1 "yes"
label values wap_october wap_octoberlabel

replace liheap_october=0 if liheap_october !=1
label define liheap_octoberlabel 0 "no" 1 "yes"
label values liheap_october liheap_octoberlabel

replace snap_october=0 if snap_october !=1
label define snap_octoberlabel 0 "no" 1 "yes"
label values snap_october snap_octoberlabel

replace tanf_october=0 if tanf_october !=1
label define tanf_octoberlabel 0 "no" 1 "yes"
label values tanf_october tanf_octoberlabel

replace ssi_october=0 if ssi_october !=1
label define ssi_octoberlabel 0 "no" 1 "yes"
label values ssi_october ssi_octoberlabel

replace medicaid_october=0 if medicaid_october !=1
label define medicaid_octoberlabel 0 "no" 1 "yes"
label values medicaid_october medicaid_octoberlabel

replace vet_benefits_october=0 if vet_benefits_october !=1
label define vet_benefits_octoberlabel 0 "no" 1 "yes"
label values vet_benefits_october vet_benefits_octoberlabel

replace unemp_insurance_october=0 if unemp_insurance_october !=1
label define unemp_insurance_octoberlabel 0 "no" 1 "yes"
label values unemp_insurance_october unemp_insurance_octoberlabel


**Binary variable representing whether respondent received government assistance in october
gen gov_assistance_october=.

replace gov_assistance_october=0 if wap_october==0 & liheap_october==0 & snap_october==0 & tanf_october==0 & ssi_october==0 & medicaid_october==0 & vet_benefits_october==0 & unemp_insurance_october==0

replace gov_assistance_october=1 if wap_october==1 | liheap_october==1 | snap_october==1 | tanf_october==1 | ssi_october==1 | medicaid_october==1 | vet_benefits_october==1 | unemp_insurance_october==1

label define gov_assistoctoberlabel 0 "No assistance" 1 "Assistance from at least one source"
label values gov_assistance_october gov_assistoctoberlabel



**did respondent receive WAP (Weatherization Assistance Program), LIHEAP (Low-Income Housing Energy Assistance Progam), SNAP, TANF, SSI, Medicaid, Veterans Benefits, Unemployment Insurance, and a COVID stimulus check in November
rename q38a_3 wap_november
rename q38b_3 liheap_november
rename q38c_3 snap_november
rename q38d_3 tanf_november
rename q38e_3 ssi_november
rename q38f_3 medicaid_november
rename q38g_3 medicare_november
rename q38h_3 vet_benefits_november
rename q38i_3 unemp_insurance_november
rename q38j_3 stimulus_november


replace wap_november=0 if wap_november !=1
label define wap_novemberlabel 0 "no" 1 "yes"
label values wap_november wap_novemberlabel

replace liheap_november=0 if liheap_november !=1
label define liheap_novemberlabel 0 "no" 1 "yes"
label values liheap_november liheap_novemberlabel

replace snap_november=0 if snap_november !=1
label define snap_novemberlabel 0 "no" 1 "yes"
label values snap_november snap_novemberlabel

replace tanf_november=0 if tanf_november !=1
label define tanf_novemberlabel 0 "no" 1 "yes"
label values tanf_november tanf_novemberlabel

replace ssi_november=0 if ssi_november !=1
label define ssi_novemberlabel 0 "no" 1 "yes"
label values ssi_november ssi_novemberlabel

replace medicaid_november=0 if medicaid_november !=1
label define medicaid_novemberlabel 0 "no" 1 "yes"
label values medicaid_november medicaid_novemberlabel

replace vet_benefits_november=0 if vet_benefits_november !=1
label define vet_benefits_novemberlabel 0 "no" 1 "yes"
label values vet_benefits_november vet_benefits_novemberlabel

replace unemp_insurance_november=0 if unemp_insurance_november !=1
label define unemp_insurance_novemberlabel 0 "no" 1 "yes"
label values unemp_insurance_november unemp_insurance_novemberlabel


**Binary variable representing whether respondent received government assistance in november
gen gov_assistance_november=.

replace gov_assistance_november=0 if wap_november==0 & liheap_november==0 & snap_november==0 & tanf_november==0 & ssi_november==0 & medicaid_november==0 & vet_benefits_november==0 & unemp_insurance_november==0

replace gov_assistance_november=1 if wap_november==1 | liheap_november==1 | snap_november==1 | tanf_november==1 | ssi_november==1 | medicaid_november==1 | vet_benefits_november==1 | unemp_insurance_november==1

label define gov_assistnovemberlabel 0 "No assistance" 1 "Assistance from at least one source"
label values gov_assistance_november gov_assistnovemberlabel



**did respondent receive WAP (Weatherization Assistance Program), LIHEAP (Low-Income Housing Energy Assistance Progam), SNAP, TANF, SSI, Medicaid, Veterans Benefits, Unemployment Insurance, and a COVID stimulus check in December
rename q38a_4 wap_december
rename q38b_4 liheap_december
rename q38c_4 snap_december
rename q38d_4 tanf_december
rename q38e_4 ssi_december
rename q38f_4 medicaid_december
rename q38g_4 medicare_december
rename q38h_4 vet_benefits_december
rename q38i_4 unemp_insurance_december
rename q38j_4 stimulus_december


replace wap_december=0 if wap_december !=1
label define wap_decemberlabel 0 "no" 1 "yes"
label values wap_december wap_decemberlabel

replace liheap_december=0 if liheap_december !=1
label define liheap_decemberlabel 0 "no" 1 "yes"
label values liheap_december liheap_decemberlabel

replace snap_december=0 if snap_december !=1
label define snap_decemberlabel 0 "no" 1 "yes"
label values snap_december snap_decemberlabel

replace tanf_december=0 if tanf_december !=1
label define tanf_decemberlabel 0 "no" 1 "yes"
label values tanf_december tanf_decemberlabel

replace ssi_december=0 if ssi_december !=1
label define ssi_decemberlabel 0 "no" 1 "yes"
label values ssi_december ssi_decemberlabel

replace medicaid_december=0 if medicaid_december !=1
label define medicaid_decemberlabel 0 "no" 1 "yes"
label values medicaid_december medicaid_decemberlabel

replace vet_benefits_december=0 if vet_benefits_december !=1
label define vet_benefits_decemberlabel 0 "no" 1 "yes"
label values vet_benefits_december vet_benefits_decemberlabel

replace unemp_insurance_december=0 if unemp_insurance_december !=1
label define unemp_insurance_decemberlabel 0 "no" 1 "yes"
label values unemp_insurance_december unemp_insurance_decemberlabel


**Binary variable representing whether respondent received government assistance in december
gen gov_assistance_december=.

replace gov_assistance_december=0 if wap_december==0 & liheap_december==0 & snap_december==0 & tanf_december==0 & ssi_december==0 & medicaid_december==0 & vet_benefits_december==0 & unemp_insurance_december==0

replace gov_assistance_december=1 if wap_december==1 | liheap_december==1 | snap_december==1 | tanf_december==1 | ssi_december==1 | medicaid_december==1 | vet_benefits_december==1 | unemp_insurance_december==1

label define gov_assistdecemberlabel 0 "No assistance" 1 "Assistance from at least one source"
label values gov_assistance_december gov_assistdecemberlabel


**did respondent receive WAP (Weatherization Assistance Program), LIHEAP (Low-Income Housing Energy Assistance Progam), SNAP, TANF, SSI, Medicaid, Veterans Benefits, Unemployment Insurance, and a COVID stimulus check in January
rename q38a_5 wap_january
rename q38b_5 liheap_january
rename q38c_5 snap_january
rename q38d_5 tanf_january
rename q38e_5 ssi_january
rename q38f_5 medicaid_january
rename q38g_5 medicare_january
rename q38h_5 vet_benefits_january
rename q38i_5 unemp_insurance_january
rename q38j_5 stimulus_january


replace wap_january=0 if wap_january !=1
label define wap_januarylabel 0 "no" 1 "yes"
label values wap_january wap_januarylabel

replace liheap_january=0 if liheap_january !=1
label define liheap_januarylabel 0 "no" 1 "yes"
label values liheap_january liheap_januarylabel

replace snap_january=0 if snap_january !=1
label define snap_januarylabel 0 "no" 1 "yes"
label values snap_january snap_januarylabel

replace tanf_january=0 if tanf_january !=1
label define tanf_januarylabel 0 "no" 1 "yes"
label values tanf_january tanf_januarylabel

replace ssi_january=0 if ssi_january !=1
label define ssi_januarylabel 0 "no" 1 "yes"
label values ssi_january ssi_januarylabel

replace medicaid_january=0 if medicaid_january !=1
label define medicaid_januarylabel 0 "no" 1 "yes"
label values medicaid_january medicaid_januarylabel

replace vet_benefits_january=0 if vet_benefits_january !=1
label define vet_benefits_januarylabel 0 "no" 1 "yes"
label values vet_benefits_january vet_benefits_januarylabel

replace unemp_insurance_january=0 if unemp_insurance_january !=1
label define unemp_insurance_januarylabel 0 "no" 1 "yes"
label values unemp_insurance_january unemp_insurance_januarylabel


**Binary variable representing whether respondent received government assistance in january
gen gov_assistance_january=.

replace gov_assistance_january=0 if wap_january==0 & liheap_january==0 & snap_january==0 & tanf_january==0 & ssi_january==0 & medicaid_january==0 & vet_benefits_january==0 & unemp_insurance_january==0

replace gov_assistance_january=1 if wap_january==1 | liheap_january==1 | snap_january==1 | tanf_january==1 | ssi_january==1 | medicaid_january==1 | vet_benefits_january==1 | unemp_insurance_january==1

label define gov_assistjanuarylabel 0 "No assistance" 1 "Assistance from at least one source"
label values gov_assistance_january gov_assistjanuarylabel




*Was respondent deemed ineligible for a government assistance program in which they applied
rename q35 assistance_ineligible
recode assistance_ineligible (2=0)
label define assistance_ineligible_label 0 "no" 1 "yes"
label values assistance_ineligible assistance_ineligible_label

rename q36_1 ineligible_wap3
rename q36_2 ineligible_liheap3
rename q36_3 ineligible_snap3
rename q36_4 ineligible_tanf3
rename q36_5 ineligible_ssi3
rename q36_6 ineligible_medicaid3
rename q36_7 ineligible_medicare3
rename q36_8 ineligible_vet_benefits3
rename q36_9 ineligible_unemp_insurance3


gen ineligible_program3=0
replace ineligible_program3=1 if ineligible_wap3==1
replace ineligible_program3=2 if ineligible_liheap3==1
replace ineligible_program3=3 if ineligible_snap3==1
replace ineligible_program3=4 if ineligible_tanf3==1
replace ineligible_program3=5 if ineligible_ssi3==1
replace ineligible_program3=6 if ineligible_medicaid3==1
replace ineligible_program3=7 if ineligible_medicare3==1
replace ineligible_program3=8 if ineligible_vet_benefits3==1
replace ineligible_program3=9 if ineligible_unemp_insurance3==1
label var ineligible_program3 "Government Assistance Last Month"
label define ineligible_program3label 0 "None" 1 "WAP" 2 "LIHEAP" 3 "SNAP" 4 "TANF" 5 "SSI" 6 "Medicaid" 7 "Medicare" 8 "Veterans Benefits" 9 "Unemployment Insurance" 10 "COVID Stimulus"
label values ineligible_program3 ineligible_program3label

*why were they deemed inelligible?
rename q37 ineligible_reason3




**Respondent used the following methods to stay warm in their home in the last 5 months
rename q39_1 stove_5mos
rename q39_2 spaceheater_5mos
rename q39_3 woodstove_5mos
rename q39_4 fireplace_5mos
rename q39_5 hotshower_5mos
rename q39_6 burntrash_5mos
rename q39_7 heavycoat_5mos
rename q39_8 dryer_5mos

replace stove_5mos=0 if stove_5mos !=1
label define stove_3label 0 "no" 1 "yes"
label values stove_5mos stove_3label

replace spaceheater_5mos=0 if spaceheater_5mos !=1
label define spaceheater_3label 0 "no" 1 "yes"
label values spaceheater_5mos spaceheater_3label

replace woodstove_5mos=0 if woodstove_5mos !=1
label define woodstove_3label 0 "no" 1 "yes"
label values woodstove_5mos woodstove_3label

replace fireplace_5mos=0 if fireplace_5mos !=1
label define fireplace_3label 0 "no" 1 "yes"
label values fireplace_5mos fireplace_3label

replace hotshower_5mos=0 if hotshower_5mos !=1
label define hotshower_3label 0 "no" 1 "yes"
label values hotshower_5mos hotshower_3label

replace burntrash_5mos=0 if burntrash_5mos !=1
label define burntrash_3label 0 "no" 1 "yes"
label values burntrash_5mos burntrash_3label

replace heavycoat_5mos=0 if heavycoat_5mos !=1
label define heavycoat_3label 0 "no" 1 "yes"
label values heavycoat_5mos heavycoat_3label

replace dryer_5mos=0 if dryer_5mos !=1
label define dryer_3label 0 "no" 1 "yes"
label values dryer_5mos dryer_3label


**binary variable representing whether a respondent used at least one strategy to stay warm in the last 5 months
gen staywarm_5mos=.

replace staywarm_5mos=0 if stove_5mos==0 & spaceheater_5mos==0 & woodstove_5mos==0 & fireplace_5mos==0 & hotshower_5mos==0 & burntrash_5mos==0 & heavycoat_5mos==0 & dryer_5mos==0


replace staywarm_5mos=1 if stove_5mos==1 | spaceheater_5mos==1 | woodstove_5mos==1 | fireplace_5mos==1 | hotshower_5mos==1 | burntrash_5mos==1 | heavycoat_5mos==1 | dryer_5mos==1


label define staywarm_5moslabel 0 "No coping strategies" 1 "At least one coping strategy"
label values staywarm_5mos staywarm_5moslabel



**Respondent used the following methods to stay cool in their home in the last 5 months
rename q40_1 centralac_5mos
rename q40_2 windowac_5mos
rename q40_3 fan_5mos
rename q40_4 dehumidifier_5mos
rename q40_5 lefthouse_5mos
rename q40_6 openedwindows_5mos
rename q40_7 boughtice_5mos
rename q40_8 coldshowers_5mos


replace centralac_5mos=0 if centralac_5mos !=1
label define centralac_3label 0 "no" 1 "yes"
label values centralac_5mos centralac_3label

replace windowac_5mos=0 if windowac_5mos !=1
label define windowac_3label 0 "no" 1 "yes"
label values windowac_5mos windowac_3label

replace fan_5mos=0 if fan_5mos !=1
label define fan_3label 0 "no" 1 "yes"
label values fan_5mos fan_3label

replace dehumidifier_5mos=0 if dehumidifier_5mos !=1
label define dehumidifier_3label 0 "no" 1 "yes"
label values dehumidifier_5mos dehumidifier_3label

replace lefthouse_5mos=0 if lefthouse_5mos !=1
label define lefthouse_3label 0 "no" 1 "yes"
label values lefthouse_5mos lefthouse_3label

replace openedwindows_5mos=0 if openedwindows_5mos !=1
label define openedwindows_3label 0 "no" 1 "yes"
label values openedwindows_5mos openedwindows_3label

replace boughtice_5mos=0 if boughtice_5mos !=1
label define boughtice_3label 0 "no" 1 "yes"
label values boughtice_5mos boughtice_3label

replace coldshowers_5mos=0 if coldshowers_5mos !=1
label define coldshowers_3label 0 "no" 1 "yes"
label values coldshowers_5mos coldshowers_3label


**binary variable representing whether a respondent used at least one strategy to stay cool in the last 5 months
gen staycool_5mos=.

replace staycool_5mos=0 if centralac_5mos==0 & windowac_5mos==0 & fan_5mos==0 & dehumidifier_5mos==0 & lefthouse_5mos==0 & openedwindows_5mos==0 & boughtice_5mos==0 & coldshowers_5mos==0


replace staycool_5mos=1 if centralac_5mos==1 | windowac_5mos==1 | fan_5mos==1 | dehumidifier_5mos==1 | lefthouse_5mos==1 | openedwindows_5mos==1 | boughtice_5mos==1 | coldshowers_5mos==1


label define staycool_5moslabel 0 "No coping strategies" 1 "At least one coping strategy"
label values staycool_5mos staycool_5moslabel

**did respondent indicate that they used air conditioning to stay cool
gen no_ac3=0
replace no_ac3=1 if centralac_5mos ==0 & windowac_5mos ==0
label define no_ac3_label 0 "Used AC" 1 "Did not use AC"
label values no_ac3 no_ac_label

**if respondent did not use air conditioning, why not (don't have A/C, chose not to use, did not need it, or unit is not functioning)
rename q41 no_ac_reason3
label define noac_label 1 "Do not have air conditioning" 2 "Choose not to use it" 3 "Unit is not functioning" 4 "Did not need it"
label values no_ac_reason3 noac_label

**did respondent skip meals in the last 5 months and how often
rename q42 skipped_meals3
recode skipped_meals3 (2=0)
label define skipped_meals3label 0 "no" 1 "yes"
label values skipped_meals3 skipped_meals3label

rename q43 skipped_meals_frequency3


**Respondent could not pay a water bill
rename q45 water_bill3
recode water_bill3 (2=0)
label define water_bill3label 0 "no" 1 "yes"
label values water_bill3 water_bill3label

**The average cost of the household's water bill
rename q44 water_cost3

**respondent had their water shutoff
rename q46 water_shutoff3
recode water_shutoff3 (2=0)
label define water_shutoff3label 0 "no" 1 "yes"
label values water_shutoff3 water_shutoff3label



**respondent has a positive COVID diagnosis
gen covid_positive3=0
replace covid_positive3=1 if q47_1==1

**respondent reported having COVID symptoms
gen covid_symptoms3=0
replace covid_symptoms3=1 if q47_2==1

**respondent had their employment impacted by the COVID hsutdowns (reduced hours, furloughed, lost employment, re-entered the workforce, decided not to work, or no change in employment)
rename q48 covid_employment3
label define covid_employment3_label 1 "Reduced hours at job" 2 "Furloughed with pay" 3 "Furloughed without pay" 4 "Lost employment" 5 "Re-entered the workforce" 6 "Decided not to work" 7 "My employment status did not change" 8 "Other"
label values covid_employment3 covid_employment3_label

gen covid_lostjobhours3=0
replace covid_lostjobhours3=1 if covid_employment3==1 | covid_employment3==3 | covid_employment3==4

**Date that respondent lost employment
rename q49 date_unemployed3

**Did respondents health insurance change during COVID
rename q50 covid_insurance3
label define covid_insurance3_label 1 "Yes, I lost my health insurance" 2 "No, but my employed put me on a less generous plan" 3 "No, my health insurance plan is the same" 4 "I didn't have health insurance before COVID-19"
label values covid_insurance3 covid_insurance3_label


rename q51 month_lostinsurance3

**Did respondent experience economic hardships due to the pandemic, including: struggling to pay rent and energy bills, struggling to feed family, and struggling to receive medical care
rename q52 covid_energybill3
label define covid_bill3_label 1 "Strongly disagree" 2 "Somewhat disagree" 3 "Neither agree nor disagree" 4 "Somewhat agree" 5 "Strongly agree"
label values covid_energybill3 covid_bill3_label
rename q53 covid_rent3
label define covid_rent3_label 1 "Strongly disagree" 2 "Somewhat disagree" 3 "Neither agree nor disagree" 4 "Somewhat agree" 5 "Strongly agree"
label values covid_rent3 covid_rent3_label
rename q54 covid_feedfamily3
label define covid_feedfamily3_label 1 "Strongly disagree" 2 "Somewhat disagree" 3 "Neither agree nor disagree" 4 "Somewhat agree" 5 "Strongly agree"
rename q55 covid_medicalcare3
label define covid_medicalcare3_label 1 "Strongly disagree" 2 "Somewhat disagree" 3 "Neither agree nor disagree" 4 "Somewhat agree" 5 "Strongly agree"
label values covid_medicalcare3 covid_medicalcare3_label


**By which method does respondent pay their energy bill (check, credit, debit, bank withdrawal, or cash)?
rename q56_1 utilitypay_check3
recode utilitypay_check3 (2=0)
label define check_label 0 "no" 1 "yes"
label values utilitypay_check3 check_label
rename q56_2 utilitypay_credit3
recode utilitypay_credit3 (2=0)
label define credit_label 0 "no" 1 "yes"
label values utilitypay_credit3 credit_label
rename q56_3 utilitypay_debit3
recode utilitypay_debit3 (2=0)
label define debit_label 0 "no" 1 "yes"
label values utilitypay_debit3 debit_label
rename q56_4 utilitypay_withdrawal3
recode utilitypay_withdrawal3 (2=0)
label define withdrawal_label 0 "no" 1 "yes"
label values utilitypay_withdrawal3 withdrawal_label
rename q56_5 utilitypay_cash3
recode utilitypay_cash3 (2=0)
label define cash_label 0 "no" 1 "yes"
label values utilitypay_cash3 cash_label
rename q57 utilitybill_pay3
label define pay_label 1 "Pay it in full" 2 "Pay a portion of it" 3 "Pay it every other month or some other interval" 4 "Not pay it" 5 "Other"
label values utilitybill_pay3 pay_label



**What do respondents do when they cannot pay their utility bill (borrow from friends, take out a payday loan, use a credit card, or do not pay until they receive a disconnection notice)
rename q58_1 utilityhelp_friend3
recode utilityhelp_friend3 (2=0)
label define friend_label 0 "no" 1 "yes"
label values utilityhelp_friend3 friend_label
rename q58_2 utilityhelp_paydayloan3
recode utilityhelp_paydayloan3 (2=0)
label define paydayloan_label 0 "no" 1 "yes"
label values utilityhelp_paydayloan3 paydayloan_label
rename q58_3 utilityhelp_credit3
recode utilityhelp_credit3 (2=0)
label define utilitycredit_label 0 "no" 1 "yes"
label values utilityhelp_credit3 utilitycredit_label
rename q58_4 utilityhelp_notice3
recode utilityhelp_notice3 (2=0)
label define utilitynotice_label 0 "no" 1 "yes"
label values utilityhelp_notice3 utilitynotice_label

**Level of utility debt the household currently owes
rename q60 utility_debt3
recode utility_debt3 (1=0) (2=25) (3=50) (4=75) (5=100) (6=125) (7=150) (8=175) (9=200) (10=225) (11=250) (12=275) (13=300) (14=325) (15=350) (16=375) (17=400) (18=425) (19=450) (20=475) (21=500) (22=525) (23=550) (24=575) (25=600) (26=625) (27=650) (28=675) (29=700) (30=725) (31=750) (32=775) (33=800) (34=825) (35=850) (36=875) (37=900) (38=925) (39=950) (40=975) (41=1000) (42=1001)
label define utility_debt_label 0 "$0" 25 "$25" 50 "$50" 75 "$75" 100 "$100" 125 "$125" 150 "$150" 175 "$175" 200 "$200" 225 "$225" 250 "$250" 275 "$275" 300 "$300" 325 "$325" 350 "$350" 375 "$375" 400 "$400" 425 "$425" 450 "$450" 475 "$475" 500 "$500" 525 "$525" 550 "$550" 575 "$575" 600 "$600" 625 "$625" 650 "$650" 675 "$675" 700 "$700" 725 "$725" 750 "$750" 775 "$775" 800 "$800" 825 "$825" 850 "$850" 875 "$875" 900 "$900" 925 "$925" 950 "$950" 975 "$975" 1000 "$1000" 1001 "More than $1000"
label values utility_debt3 utility_debt_label

**Respondent has more than $1000 in utility debt
rename q61 debt_over10003
recode debt_over10003 (2=1)
label define over1000_label 1 "yes"
label values debt_over10003 over1000_label


**Are respondents behind on other payments (rent, credit cards, car payments, medical costs,bank loans, personal loans, or student loans?)
rename q62_1 behind_rent3
recode behind_rent3 (2=0)
label define behind_rentlabel 0 "no" 1 "yes"
label values behind_rent3 behind_rentlabel
rename q62_2 behind_credit3
recode behind_credit3 (2=0)
label define behind_creditlabel 0 "no" 1 "yes"
label values behind_credit3 behind_creditlabel
rename q62_3 behind_car3
recode behind_car3 (2=0)
label define behind_carlabel 0 "no" 1 "yes"
label values behind_car3 behind_carlabel
rename q62_4 behind_medical3
recode behind_medical3 (2=0)
label define behind_medicallabel 0 "no" 1 "yes"
label values behind_medical3 behind_medicallabel
rename q62_5 behind_bankloan3
recode behind_bankloan3 (2=0)
label define behind_bankloanlabel 0 "no" 1 "yes"
label values behind_bankloan3 behind_bankloanlabel
rename q62_6 behind_personalloan3
recode behind_personalloan3 (2=0)
label define behind_personalloanlabel 0 "no" 1 "yes"
label values behind_personalloan3 behind_personalloanlabel
rename q62_7 behind_studentloan3
recode behind_studentloan3 (2=0)
label define behind_studentloanlabel 0 "no" 1 "yes"
label values behind_studentloan3 behind_studentloanlabel

**Has respondent received a eviction notice in the last 5 months (September, October, November, December, January)
rename q63_1 evictnotice_september
recode evictnotice_september (2=0)
label define evictnotice_septemberlabel 0 "no" 1 "yes"
label values evictnotice_september evictnotice_septemberlabel
rename q63_2 evictnotice_october
recode evictnotice_october (2=0)
label define evictnotice_octoberlabel 0 "no" 1 "yes"
label values evictnotice_october evictnotice_octoberlabel
rename q63_3 evictnotice_november
recode evictnotice_november (2=0)
label define evictnotice_novemberlabel 0 "no" 1 "yes"
label values evictnotice_november evictnotice_novemberlabel
rename q63_4 evictnotice_december
recode evictnotice_december (2=0)
label define evictnotice_decemberlabel 0 "no" 1 "yes"
label values evictnotice_december evictnotice_decemberlabel
rename q63_5 evictnotice_january
recode evictnotice_january (2=0)
label define evictnotice_januarylabel 0 "no" 1 "yes"
label values evictnotice_january evictnotice_januarylabel

gen evictnotice_5months=0
replace evictnotice_5months=1 if evictnotice_september==1
replace evictnotice_5months=2 if evictnotice_october==1
replace evictnotice_5months=3 if evictnotice_november==1
replace evictnotice_5months=4 if evictnotice_december==1
replace evictnotice_5months=5 if evictnotice_january==1
label define evictnotice_5months_label 0 "no" 1 "september" 2 "october" 3 "november" 4 "december" 5 "janury"
label values evictnotice_5months evicted_5months_label


**Has respondent been evicted in the last 5 months (September, October, November, December, January)
rename q64 evictmonth_5months
recode evictmonth_5months (6=0)

gen evicted_5months=0
replace evicted_5months =1 if evictmonth_5months > 0
label define evicted_label 0 "no" 1 "yes"
label values evicted_5months evicted_label


gen evicted_september=0
replace evicted_september=1 if evictmonth_5months==1
label define evicted_septemberlabel 0 "no" 1 "yes"
label values evicted_september evicted_septemberlabel

gen evicted_october=0
replace evicted_october=1 if evictmonth_5months==2
label define evicted_octoberlabel 0 "no" 1 "yes"
label values evicted_october evicted_octoberlabel

gen evicted_november=0
replace evicted_november=1 if evictmonth_5months==3
label define evicted_novemberlabel 0 "no" 1 "yes"
label values evicted_november evicted_novemberlabel

gen evicted_december=0
replace evicted_december=1 if evictmonth_5months==3
label define evicted_decemberlabel 0 "no" 1 "yes"
label values evicted_december evicted_decemberlabel

gen evicted_january=0
replace evicted_january=1 if evictmonth_5months==3
label define evicted_januarylabel 0 "no" 1 "yes"
label values evicted_january evicted_januarylabel



**has respondent sought legal help to deal with utility disconnection
rename q65 legal_help3
recode legal_help3 (2=0)
label define legalhelp_label 0 "no" 1 "yes"
label values legal_help3 legalhelp_label
rename q66 legal_access3
recode legal_access3 (2=0)
label define legalaccess_label 0 "no" 1 "yes"
label values legal_access3 legalaccess_label
rename q67 legal_source3
label define legalsource_label 1 "Hired a lawyer" 2 "Got help from a friend, family member, or other personal contact" 3 "An organization provided free legal service" 4 "Other"
label values legal_source3 legalsource_label


**how does respondent generally rate their health
rename q68 generalhealth_rate3
label define healthrate_label 1 "Excellent" 2 "Very good" 3 "Good" 4 "Fair" 5 "Poor" 6 "Don't know/notsure"
label values generalhealth_rate3 healthrate_label

**does a household member have a medical condition that requires prescription medication
rename q69 prescription3
recode prescription3 (2=0)
label define prescription_label 0 "no" 1 "yes"
label values prescription3 prescription_label

**if a household member requires prescription meidcation, have they not been able to fill that prescription in the last 3 months?
renam q70 fill_prescription3
recode fill_prescription3 (2=0)
label define fillprescript_label 0 "no" 1 "yes"
label values fill_prescription3 fillprescript_label

**In how many days over the last month did the respondent indicate that their mental health has been poor
rename q71 mentalhealth_days3
label define mentalhealth_label 0 "0" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8" 9 "9" 10 "10" 11 "11" 12 "12" 13 "13" 14 "14" 15 "15" 16 "16" 17 "17" 18 "18" 19 "19" 20 "20" 21 "21" 22 "22" 23 "23" 24 "24" 25 "25" 26 "26" 27 "27" 28 "28" 29 "29" 30 "30" 31 "Don't know/not sure"
label values mentalhealth_days3 mentalhealth_label


**Does respondent have various health consitions
gen highbloodpressure3=0
replace highbloodpressure3=1 if q71a==1
label define highpressure_label 0 "no" 1 "yes"
label values highbloodpressure3 highpressure_label
gen heartdisease3=0
replace heartdisease3=1 if q71b==1
label define heartdisease_label 0 "no" 1 "yes"
label values heartdisease3 heartdisease_label
gen diabetes3=0
replace diabetes3=1 if q71c==1
label define diabetes_label 0 "no" 1 "yes"
label values diabetes3 diabetes_label
gen cancer3=0
replace cancer3=1 if q71d==1
label define cancer_label 0 "no" 1 "yes"
label values cancer3 cancer_label
gen obesity3=0
replace obesity3=1 if q71e==1
label define obesity_label 0 "no" 1 "yes"
label values obesity3 obesity_label
gen asthma3=0
replace asthma3=1 if q71f==1
label define asthma_label 0 "no" 1 "yes"
label values asthma3 asthma_label





***************************Cleaning up variables*******************************
**employment status
gen employed3 = 0
replace employed3 = 0 if employ >1
replace employed3 = 1 if employ <3
label var employed3 "employed?"
label define employedlabel 0 "no" 1 "yes"
label values employed3 employedlabel

gen unemployed3 =0
replace unemployed3 =1 if employ==3 | employ==4
label var unemployed3 "unemployed"
label define unemployed3label 0 "no" 1 "yes"
label values unemployed3 unemployed3label

rename employ employ3

*lost insurance due to COVID*
gen covid_lostinsurance3=.
replace covid_lostinsurance3=0 if covid_insurance3==2 | covid_insurance3==3 | covid_insurance3 ==4
replace covid_lostinsurance3=1 if covid_insurance3==1
label define lostinsurance 0 "Did not lose insurance" 1 "Lost Insurance"
lab val covid_lostinsurance3 lostinsurance

**high school degree or less
gen educ_HS3 = (educ3==1|educ3==2)
label var educ_HS3 "respondent has high school degree or less"
label define educ_HS_label 0 "No" 1 "Yes"
label values educ_HS3 educ_HS_label

**any children under 5
gen any_under53 = (hh_under53>0)
recode any_under53 *=. if hh_under53==.
label var any_under53 "at least one person in the house is under 5"
label define any_label 0 "No" 1 "Yes"
label values any_under53 any_label

**any household members over 65
gen any_over653 = (hh_over653>0)
recode any_over653 *=. if hh_over653==.
label var any_over653 "at least one person in the house is over 65"
label define any_over_label 0 "No" 1 "Yes"
label values any_over653 any_over_label

**Lost work due to COVID
gen covid_lostwork3 = (covid_employment3==1|covid_employment3==3|covid_employment3==4)
recode covid_lostwork3 *=. if covid_employment3==.
label var covid_lostwork3 "Respondent lost work pay or hours due to the pandemic"
label define lostwork_label 0 "No" 1 "Yes"
label values covid_lostwork3 lostwork_label

**no or worse insurance due to COVID
gen covid_lessinsurance3 = (covid_insurance3==1| covid_insurance3==2)
recode covid_lessinsurance3 *=. if covid_insurance3==.
label var covid_lessinsurance3 "respondent lost health insurance or employer put them on less generous plan"
label define less_insure_label 0 "No" 1 "Yes"
label values covid_lessinsurance3 less_insure_label

gen no_insurance3 = (covid_insurance3==1|covid_insurance3==4)
recode no_insurance3 *=. if covid_insurance3==.
label var no_insurance3 "respondent lost insurance or didn't have any to begin with"
label define no_insure_label 0 "No" 1 "Yes"
label values no_insurance3 no_insure_label

**any household memebrs with a disability
gen any_disability3 = (hh_disability3>0)
recode any_disability3 *=. if hh_disability3==.
label var any_disability3 "at least one person in the house has a disability"
label define any_disability_label 0 "No" 1 "Yes"
label values any_disability3 any_disability_label

**respondent lives in a trailer or mobile home
gen home_trailer3 = (dwelling_type3==1)
recode home_trailer3 *=. if dwelling_type3==.
label var home_trailer3 "respondent's home is trailer or mobile home"
label define home_trailer_label 0 "No" 1 "Yes"
label values home_trailer3 home_trailer_label

**respondent lives in an apartment, duplex, or condo
gen home_apartmentcondo3 = (dwelling_type3==2)
recode home_apartmentcondo3 *=. if dwelling_type3==.
label var home_apartmentcondo3 "respondent's home is apartment, duplex, or condo"
label define home_apartmentcondo_label 0 "No" 1 "Yes"
label values home_apartmentcondo3 home_apartmentcondo_label

**respondent lives in a single family home
gen home_singlefam3 = (dwelling_type3==3|dwelling_type3==4)
recode home_singlefam3 *=. if dwelling_type3==.
label var home_singlefam3 "respondent's home is a single family home, either attached or detached"
label define home_singlefam_label 0 "No" 1 "Yes"
label values home_singlefam3 home_singlefam_label

**respondent indicated "other" as their dwelling type
gen home_other3 = (dwelling_type3==5)
recode home_other3 *=. if dwelling_type3==.
label var home_other3 "respondent's home is recorded as other"
label define home_other_label 0 "No" 1 "Yes"
label values home_other3 home_other_label

***respondent makes irregular utility payments
gen utilitybill_pay_irregular3 = (utilitybill_pay3==2|utilitybill_pay3==3|utilitybill_pay3==4)
recode utilitybill_pay_irregular3 *=. if utilitybill_pay3==.
label var utilitybill_pay_irregular3 "respondent pays portion of bill, every other bill, or doesn't pay"
label define irregular_label 0 "No" 1 "Yes"
label values utilitybill_pay_irregular3 irregular_label

**respondent has over $100 in utility debt
gen utilitydebt_over1003 = (utility_debt3>100)
recode utilitydebt_over1003 *=. if utility_debt3==.
label var utilitydebt_over1003 "respondent owes more than $100 in debt to utility"
label define over100_label 0 "No" 1 "Yes"
label values utilitydebt_over1003 over100_label

**respondent indicated their general health status was good to great
gen genhealth_goodtogreat3 = (generalhealth_rate3==1|generalhealth_rate3==2|generalhealth_rate3==3)
recode genhealth_goodtogreat3 *=. if generalhealth_rate3==.
label var genhealth_goodtogreat3 "respondent reports good, very good, or excellent overall health"
label define goodgreat_label 0 "No" 1 "Yes"
label values genhealth_goodtogreat3 goodgreat_label


**rename open responses
rename q59_other maintainbills_open3
rename q61_open debt_over1000_open3
rename q71_other chronic_conditions_open3
rename q48_other covid_employmentchange_open3
rename q57_other utilitybillpay_open3
rename q58_other utilitybillhelp_open3
rename q56_other utilitypaymethod_open3
rename q40_other staycool_open3
rename q39_other staywarm_open3
rename q34_other govassist_open3
rename q30_other energyassist_open3
rename q25_other response_notice_open3
rename q14_other energyefficiency_open3









****FPL levels (numeric)****
gen hhinc3 = "100% FPL or below" if hh1_income3==1
forvalues i = 2(1)8 {
replace hhinc3 = "100% FPL or below" if hh`i'_income3==1
}
forvalues i = 1(1)8 {
replace hhinc3 = "100%-150% FPL" if hh`i'_income3==2 | hh`i'_income3==3
}
forvalues i = 1(1)8 {
replace hhinc3 = "150%-200% FPL" if hh`i'_income3==4 | hh`i'_income3==5
}
forvalues i = 1(1)8 {
replace hhinc3 = "Over 200% FPL" if hh`i'_income3==6
}
encode hhinc3, gen(fpl3)


***Income levels by FPL***
gen under_100_fpl3=.
replace under_100_fpl3=0 if fpl3==2 | fpl3==3 | fpl3==4
replace under_100_fpl3=1 if fpl3==1

gen FPL_100_1503=.
replace FPL_100_1503=0 if fpl3==1 | fpl3==3 | fpl3==4
replace FPL_100_1503=1 if fpl3==2

gen FPL_150_2003=.
replace FPL_150_2003=0 if fpl3==1 | fpl3==2 | fpl3==4
replace FPL_150_2003=1 if fpl3==3

gen FPL_over_2003=.
replace FPL_over_2003=0 if fpl3==1 | fpl3==2 | fpl3==3
replace FPL_over_2003=1 if fpl3==4


gen white=0
replace white=1 if race==1

gen black=0
replace black=1 if race==2

gen hispanic=0
replace hispanic=1 if race==3

gen native_american=0
replace native_american=1 if race==5

gen female=0
replace female=1 if gender==2

gen age = 2020-birthyr

gen wave3=1

*****Merge zip code, urban vs rural percentage*****
sort inputzip
merge m:1 inputzip using zcta_urban_v2.dta
drop if _m==2
rename inputzip inputzip3


save energy_insecurity_survey_wave3V3.dta, replace